/* 通用JS库 1.0.3  */
var origin = $.extend({}, origin);

/* 定义全局对象，类似于命名空间或包的作用 */

function Clock() {
    var date = new Date();
    this.year = date.getFullYear();
    this.month = date.getMonth() + 1;
    this.date = date.getDate();
    this.day = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")[date.getDay()];
    this.hour = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
    this.minute = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
    this.second = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();

    this.toString = function () {
        return "" + this.year + "年" + this.month + "月" + this.date + "日 " + this.hour + ":" + this.minute + ":" + this.second + " " + this.day;
    };

    this.toSimpleDate = function () {
        return this.year + "-" + this.month + "-" + this.date;
    };

    this.toDetailDate = function () {
        return this.year + "-" + this.month + "-" + this.date + " " + this.hour + ":" + this.minute + ":" + this.second;
    };

    this.display = function (ele) {
        var clock = new Clock();
        ele.innerHTML = clock.toString();
        window.setTimeout(function () {
            clock.display(ele);
        }, 1000);
    };
}

/**
 *
 * 获得项目根路径
 * 使用方法：origin.bp();
 * @returns 项目根路径
 */
origin.bp = function () {
    var curWwwPath = window.document.location.href;
    var pathName = window.document.location.pathname;
    var pos = curWwwPath.indexOf(pathName);
    var localhostPaht = curWwwPath.substring(0, pos);
    var projectName = pathName.substring(0, pathName.substr(1).indexOf('/') + 1);
    return (localhostPaht + projectName);
};

/**
 * 使用方法:origin.pn();
 * @returns 项目名称(/web)
 */
origin.pn = function () {
    return window.document.location.pathname.substring(0, window.document.location.pathname.indexOf('\/', 1));
};

/**
 * 增加formatString功能
 *
 * 使用方法：origin.fs('字符串{0}字符串{1}字符串','第一个变量','第二个变量');
 *
 * @returns 格式化后的字符串
 */
origin.fs = function (str) {
    for (var i = 0; i < arguments.length - 1; i++) {
        str = str.replace("{" + i + "}", arguments[i + 1]);
    }
    return str;
};

origin.getFileUrl = function (url) {
    if (url != null && url != undefined && url.indexOf('http:') < 0) {
        return $uploadPath + '/' + url;
    }
    return url == '' ? undefined : url;
};

/**
 * 生成UUID
 * @returns UUID字符串
 */
origin.random4 = function () {
    return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
};

origin.UUID = function () {
    return (origin.random4() + origin.random4() + "-" + origin.random4() + "-" + origin.random4() + "-" + origin.random4() + "-" + origin.random4() + origin.random4() + origin.random4());
};

/**
 * 获得URL参数
 * @returns 对应名称的值
 */
origin.getUrlParam = function (name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null)
        return unescape(r[2]);
    return null;
};

/**
 * 接收一个以逗号分割的字符串，返回List，list里每一项都是一个字符串
 * @returns list
 */
origin.getList = function (value) {
    if (value != undefined && value != '') {
        var values = [];
        var t = value.split(',');
        for (var i = 0; i < t.length; i++) {
            values.push('' + t[i]);
            /* 避免他将ID当成数字 */
        }
        return values;
    } else {
        return [];
    }
};

/**
 * 判断浏览器是否是IE并且版本小于8
 */
origin.isLessThanIe8 = function () {
    return ($.browser.msie && $.browser.version < 8);
};

/**
 * 将form表单元素的值序列化成对象
 */
origin.serializeObject = function (form) {
    var o = {};
    $.each(form.serializeArray(), function (index) {
        if (o[this['name']]) {
            o[this['name']] = o[this['name']] + "," + this['value'];
        } else {
            o[this['name']] = this['value'];
        }
    });
    return o;
};

/**
 * 将JSON对象转换成字符串
 */
origin.jsonToString = function (o) {
    var r = [];
    if (typeof o == "string")
        return "\"" + o.replace(/([\'\"\\])/g, "\\$1").replace(/(\n)/g, "\\n").replace(/(\r)/g, "\\r").replace(/(\t)/g, "\\t") + "\"";
    if (typeof o == "object") {
        if (!o.sort) {
            for (var i in o)
                r.push(i + ":" + origin.jsonToString(o[i]));
            if (!!document.all && !/^\n?function\s*toString\(\)\s*\{\n?\s*\[native code\]\n?\s*\}\n?\s*$/.test(o.toString)) {
                r.push("toString:" + o.toString.toString());
            }
            r = "{" + r.join() + "}";
        } else {
            for (var i = 0; i < o.length; i++)
                r.push(origin.jsonToString(o[i]));
            r = "[" + r.join() + "]";
        }
        return r;
    }
    return o.toString();
};


/**
 * 格式化数字显示方式
 * 用法
 * formatNumber(12345.999,'#,##0.00');
 * formatNumber(12345.999,'#,##0.##');
 * formatNumber(123,'000000');
 * @param num
 * @param pattern
 */
origin.formatNumber = function (num, pattern) {
    var strarr = num ? num.toString().split('.') : ['0'];
    var fmtarr = pattern ? pattern.split('.') : [''];
    var retstr = '';

    // 整数部分
    var str = strarr[0];
    var fmt = fmtarr[0];
    var i = str.length - 1;
    var comma = false;
    for (var f = fmt.length - 1; f >= 0; f--) {
        switch (fmt.substr(f, 1)) {
            case '#':
                if (i >= 0)
                    retstr = str.substr(i--, 1) + retstr;
                break;
            case '0':
                if (i >= 0)
                    retstr = str.substr(i--, 1) + retstr;
                else
                    retstr = '0' + retstr;
                break;
            case ',':
                comma = true;
                retstr = ',' + retstr;
                break;
        }
    }
    if (i >= 0) {
        if (comma) {
            var l = str.length;
            for (; i >= 0; i--) {
                retstr = str.substr(i, 1) + retstr;
                if (i > 0 && ((l - i) % 3) == 0)
                    retstr = ',' + retstr;
            }
        } else
            retstr = str.substr(0, i + 1) + retstr;
    }

    retstr = retstr + '.';
    // 处理小数部分
    str = strarr.length > 1 ? strarr[1] : '';
    fmt = fmtarr.length > 1 ? fmtarr[1] : '';
    i = 0;
    for (var f = 0; f < fmt.length; f++) {
        switch (fmt.substr(f, 1)) {
            case '#':
                if (i < str.length)
                    retstr += str.substr(i++, 1);
                break;
            case '0':
                if (i < str.length)
                    retstr += str.substr(i++, 1);
                else
                    retstr += '0';
                break;
        }
    }
    return retstr.replace(/^,+/, '').replace(/\.$/, '');
};

/**
 *
 * 格式化日期时间
 *
 * @param format
 * @returns
 */
Date.prototype.format = function (format) {
    if (isNaN(this.getMonth())) {
        return '';
    }
    if (!format) {
        format = "yyyy-MM-dd hh:mm:ss";
    }
    var o = {
        /* month */
        "M+": this.getMonth() + 1,
        /* day */
        "d+": this.getDate(),
        /* hour */
        "h+": this.getHours(),
        /* minute */
        "m+": this.getMinutes(),
        /* second */
        "s+": this.getSeconds(),
        /* quarter */
        "q+": Math.floor((this.getMonth() + 3) / 3),
        /* millisecond */
        "S": this.getMilliseconds()
    };
    if (/(y+)/.test(format)) {
        format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
    }
    for (var k in o) {
        if (new RegExp("(" + k + ")").test(format)) {
            format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
        }
    }
    return format;
};


var XDate = function (g, m, A, p) {
    function f() {
        var a = this instanceof f ? this : new f, c = arguments, b = c.length, d;
        typeof c[b - 1] == "boolean" && (d = c[--b], c = q(c, 0, b));
        if (b) if (b == 1) if (b = c[0], b instanceof g || typeof b == "number") a[0] = new g(+b); else if (b instanceof f) {
            var c = a, h = new g(+b[0]);
            if (l(b)) h.toString = w;
            c[0] = h
        } else {
            if (typeof b == "string") {
                a[0] = new g(0);
                a:{
                    for (var c = b, b = d || !1, h = f.parsers, r = 0, e; r < h.length; r++) if (e = h[r](c, b, a)) {
                        a = e;
                        break a
                    }
                    a[0] = new g(c)
                }
            }
        } else a[0] = new g(n.apply(g, c)), d || (a[0] = s(a[0])); else a[0] = new g;
        typeof d == "boolean" && B(a, d);
        return a
    }

    function l(a) {
        return a[0].toString === w
    }

    function B(a, c, b) {
        if (c) {
            if (!l(a)) b && (a[0] = new g(n(a[0].getFullYear(), a[0].getMonth(), a[0].getDate(), a[0].getHours(), a[0].getMinutes(), a[0].getSeconds(), a[0].getMilliseconds()))), a[0].toString = w
        } else l(a) && (a[0] = b ? s(a[0]) : new g(+a[0]));
        return a
    }

    function C(a, c, b, d, h) {
        var e = k(j, a[0], h), a = k(D, a[0], h), h = c == 1 ? b % 12 : e(1), f = !1;
        d.length == 2 && typeof d[1] == "boolean" && (f = d[1], d = [b]);
        a(c, d);
        f && e(1) != h && (a(1, [e(1) - 1]), a(2, [E(e(0), e(1))]))
    }

    function F(a, c, b, d) {
        var b = Number(b), h = m.floor(b);
        a["set" + o[c]](a["get" + o[c]]() + h, d || !1);
        h != b && c < 6 && F(a, c + 1, (b - h) * G[c], d)
    }

    function H(a, c, b) {
        var a = a.clone().setUTCMode(!0, !0), c = f(c).setUTCMode(!0, !0), d = 0;
        if (b == 0 || b == 1) {
            for (var h = 6; h >= b; h--) d /= G[h], d += j(c, !1, h) - j(a, !1, h);
            b == 1 && (d += (c.getFullYear() - a.getFullYear()) * 12)
        } else b == 2 ? (b = a.toDate().setUTCHours(0, 0, 0, 0), d = c.toDate().setUTCHours(0, 0, 0, 0), d = m.round((d - b) / 864E5) + (c - d - (a - b)) / 864E5) : d = (c - a) / [36E5, 6E4, 1E3, 1][b - 3];
        return d
    }

    function t(a) {
        var c = a(0),
            b = a(1), a = a(2), b = new g(n(c, b, a)), d = u(c), a = d;
        b < d ? a = u(c - 1) : (c = u(c + 1), b >= c && (a = c));
        return m.floor(m.round((b - a) / 864E5) / 7) + 1
    }

    function u(a) {
        a = new g(n(a, 0, 4));
        a.setUTCDate(a.getUTCDate() - (a.getUTCDay() + 6) % 7);
        return a
    }

    function I(a, c, b, d) {
        var h = k(j, a, d), e = k(D, a, d), b = u(b === p ? h(0) : b);
        d || (b = s(b));
        a.setTime(+b);
        e(2, [h(2) + (c - 1) * 7])
    }

    function J(a, c, b, d, e) {
        var r = f.locales, g = r[f.defaultLocale] || {}, i = k(j, a, e), b = (typeof b == "string" ? r[b] : b) || {};
        return x(a, c, function (a) {
            if (d) for (var b = (a == 7 ? 2 : a) - 1; b >= 0; b--) d.push(i(b));
            return i(a)
        }, function (a) {
            return b[a] || g[a]
        }, e)
    }

    function x(a, c, b, d, e) {
        for (var f, g, i = ""; f = c.match(M);) {
            i += c.substr(0, f.index);
            if (f[1]) {
                g = i;
                for (var i = a, j = f[1], l = b, m = d, n = e, k = j.length, o = void 0, q = ""; k > 0;) o = N(i, j.substr(0, k), l, m, n), o !== p ? (q += o, j = j.substr(k), k = j.length) : k--;
                i = g + (q + j)
            } else f[3] ? (g = x(a, f[4], b, d, e), parseInt(g.replace(/\D/g, ""), 10) && (i += g)) : i += f[7] || "'";
            c = c.substr(f.index + f[0].length)
        }
        return i + c
    }

    function N(a, c, b, d, e) {
        var g = f.formatters[c];
        if (typeof g == "string") return x(a, g, b, d, e); else if (typeof g ==
            "function") return g(a, e || !1, d);
        switch (c) {
            case "fff":
                return i(b(6), 3);
            case "s":
                return b(5);
            case "ss":
                return i(b(5));
            case "m":
                return b(4);
            case "mm":
                return i(b(4));
            case "h":
                return b(3) % 12 || 12;
            case "hh":
                return i(b(3) % 12 || 12);
            case "H":
                return b(3);
            case "HH":
                return i(b(3));
            case "d":
                return b(2);
            case "dd":
                return i(b(2));
            case "ddd":
                return d("dayNamesShort")[b(7)] || "";
            case "dddd":
                return d("dayNames")[b(7)] || "";
            case "M":
                return b(1) + 1;
            case "MM":
                return i(b(1) + 1);
            case "MMM":
                return d("monthNamesShort")[b(1)] || "";
            case "MMMM":
                return d("monthNames")[b(1)] || "";
            case "yy":
                return (b(0) + "").substring(2);
            case "yyyy":
                return b(0);
            case "t":
                return v(b, d).substr(0, 1).toLowerCase();
            case "tt":
                return v(b, d).toLowerCase();
            case "T":
                return v(b, d).substr(0, 1);
            case "TT":
                return v(b, d);
            case "z":
            case "zz":
            case "zzz":
                return e ? c = "Z" : (d = a.getTimezoneOffset(), a = d < 0 ? "+" : "-", b = m.floor(m.abs(d) / 60), d = m.abs(d) % 60, e = b, c == "zz" ? e = i(b) : c == "zzz" && (e = i(b) + ":" + i(d)), c = a + e), c;
            case "w":
                return t(b);
            case "ww":
                return i(t(b));
            case "S":
                return c = b(2), c >
                10 && c < 20 ? "th" : ["st", "nd", "rd"][c % 10 - 1] || "th"
        }
    }

    function v(a, c) {
        return a(3) < 12 ? c("amDesignator") : c("pmDesignator")
    }

    function y(a) {
        return !isNaN(+a[0])
    }

    function j(a, c, b) {
        return a["get" + (c ? "UTC" : "") + o[b]]()
    }

    function D(a, c, b, d) {
        a["set" + (c ? "UTC" : "") + o[b]].apply(a, d)
    }

    function s(a) {
        return new g(a.getUTCFullYear(), a.getUTCMonth(), a.getUTCDate(), a.getUTCHours(), a.getUTCMinutes(), a.getUTCSeconds(), a.getUTCMilliseconds())
    }

    function E(a, c) {
        return 32 - (new g(n(a, c, 32))).getUTCDate()
    }

    function z(a) {
        return function () {
            return a.apply(p,
                [this].concat(q(arguments)))
        }
    }

    function k(a) {
        var c = q(arguments, 1);
        return function () {
            return a.apply(p, c.concat(q(arguments)))
        }
    }

    function q(a, c, b) {
        return A.prototype.slice.call(a, c || 0, b === p ? a.length : b)
    }

    function K(a, c) {
        for (var b = 0; b < a.length; b++) c(a[b], b)
    }

    function i(a, c) {
        c = c || 2;
        for (a += ""; a.length < c;) a = "0" + a;
        return a
    }

    var o = "FullYear,Month,Date,Hours,Minutes,Seconds,Milliseconds,Day,Year".split(","),
        L = ["Years", "Months", "Days"], G = [12, 31, 24, 60, 60, 1E3, 1],
        M = /(([a-zA-Z])\2*)|(\((('.*?'|\(.*?\)|.)*?)\))|('(.*?)')/,
        n = g.UTC, w = g.prototype.toUTCString, e = f.prototype;
    e.length = 1;
    e.splice = A.prototype.splice;
    e.getUTCMode = z(l);
    e.setUTCMode = z(B);
    e.getTimezoneOffset = function () {
        return l(this) ? 0 : this[0].getTimezoneOffset()
    };
    K(o, function (a, c) {
        e["get" + a] = function () {
            return j(this[0], l(this), c)
        };
        c != 8 && (e["getUTC" + a] = function () {
            return j(this[0], !0, c)
        });
        c != 7 && (e["set" + a] = function (a) {
            C(this, c, a, arguments, l(this));
            return this
        }, c != 8 && (e["setUTC" + a] = function (a) {
            C(this, c, a, arguments, !0);
            return this
        }, e["add" + (L[c] || a)] = function (a, d) {
            F(this,
                c, a, d);
            return this
        }, e["diff" + (L[c] || a)] = function (a) {
            return H(this, a, c)
        }))
    });
    e.getWeek = function () {
        return t(k(j, this, !1))
    };
    e.getUTCWeek = function () {
        return t(k(j, this, !0))
    };
    e.setWeek = function (a, c) {
        I(this, a, c, !1);
        return this
    };
    e.setUTCWeek = function (a, c) {
        I(this, a, c, !0);
        return this
    };
    e.addWeeks = function (a) {
        return this.addDays(Number(a) * 7)
    };
    e.diffWeeks = function (a) {
        return H(this, a, 2) / 7
    };
    f.parsers = [function (a, c, b) {
        if (a = a.match(/^(\d{4})(-(\d{2})(-(\d{2})([T ](\d{2}):(\d{2})(:(\d{2})(\.(\d+))?)?(Z|(([-+])(\d{2})(:?(\d{2}))?))?)?)?)?$/)) {
            var d =
                new g(n(a[1], a[3] ? a[3] - 1 : 0, a[5] || 1, a[7] || 0, a[8] || 0, a[10] || 0, a[12] ? Number("0." + a[12]) * 1E3 : 0));
            a[13] ? a[14] && d.setUTCMinutes(d.getUTCMinutes() + (a[15] == "-" ? 1 : -1) * (Number(a[16]) * 60 + (a[18] ? Number(a[18]) : 0))) : c || (d = s(d));
            return b.setTime(+d)
        }
    }];
    f.parse = function (a) {
        return +f("" + a)
    };
    e.toString = function (a, c, b) {
        return a === p || !y(this) ? this[0].toString() : J(this, a, c, b, l(this))
    };
    e.toUTCString = e.toGMTString = function (a, c, b) {
        return a === p || !y(this) ? this[0].toUTCString() : J(this, a, c, b, !0)
    };
    e.toISOString = function () {
        return this.toUTCString("yyyy-MM-dd'T'HH:mm:ss(.fff)zzz")
    };
    f.defaultLocale = "";
    f.locales = {
        "": {
            monthNames: "January,February,March,April,May,June,July,August,September,October,November,December".split(","),
            monthNamesShort: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),
            dayNames: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),
            dayNamesShort: "Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),
            amDesignator: "AM",
            pmDesignator: "PM"
        }
    };
    f.formatters = {i: "yyyy-MM-dd'T'HH:mm:ss(.fff)", u: "yyyy-MM-dd'T'HH:mm:ss(.fff)zzz"};
    K("getTime,valueOf,toDateString,toTimeString,toLocaleString,toLocaleDateString,toLocaleTimeString,toJSON".split(","),
        function (a) {
            e[a] = function () {
                return this[0][a]()
            }
        });
    e.setTime = function (a) {
        this[0].setTime(a);
        return this
    };
    e.valid = z(y);
    e.clone = function () {
        return new f(this)
    };
    e.clearTime = function () {
        return this.setHours(0, 0, 0, 0)
    };
    e.toDate = function () {
        return new g(+this[0])
    };
    f.now = function () {
        return +new g
    };
    f.today = function () {
        return (new f).clearTime()
    };
    f.UTC = n;
    f.getDaysInMonth = E;
    if (typeof module !== "undefined" && module.exports) module.exports = f;
    return f
}(Date, Math, Array);

/*
 * ! jQuery Cookie Plugin v1.3 https://github.com/carhartl/jquery-cookie
 * 
 * Copyright 2011, Klaus Hartl Dual licensed under the MIT or GPL Version 2
 * licenses. http://www.opensource.org/licenses/mit-license.php
 * http://www.opensource.org/licenses/GPL-2.0
 */
(function ($, document, undefined) {

    var pluses = /\+/g;

    function raw(s) {
        return s;
    }

    function decoded(s) {
        return decodeURIComponent(s.replace(pluses, ' '));
    }

    var config = $.cookie = function (key, value, options) {

        // write
        if (value !== undefined) {
            options = $.extend({}, config.defaults, options);

            if (value === null) {
                options.expires = -1;
            }

            if (typeof options.expires === 'number') {
                var days = options.expires, t = options.expires = new Date();
                t.setDate(t.getDate() + days);
            }

            value = config.json ? JSON.stringify(value) : String(value);

            return (document.cookie = [
                encodeURIComponent(key),
                '=',
                config.raw ? value : encodeURIComponent(value),
                options.expires ? '; expires='
                    + options.expires.toUTCString() : '', // use
                // expires
                // attribute,
                // max-age
                // is not
                // supported
                // by IE
                options.path ? '; path=' + options.path : '',
                options.domain ? '; domain=' + options.domain : '',
                options.secure ? '; secure' : ''].join(''));
        }

        // read
        var decode = config.raw ? raw : decoded;
        var cookies = document.cookie.split('; ');
        for (var i = 0, l = cookies.length; i < l; i++) {
            var parts = cookies[i].split('=');
            if (decode(parts.shift()) === key) {
                var cookie = decode(parts.join('='));
                return config.json ? JSON.parse(cookie) : cookie;
            }
        }

        return null;
    };

    config.defaults = {};

    $.removeCookie = function (key, options) {
        if ($.cookie(key) !== null) {
            $.cookie(key, null, options);
            return true;
        }
        return false;
    };

})(jQuery, document);

var basicParams = {
    numberFixed: 2,//数据保留小数位数
    priceFixed: 2,//价格保留小数位数
    percentFixed: 2,//百分数保留小数位数
    pageList: [20, 50, 100]
};


/**
 * 基本函数
 * @param {Object} v
 * @return {TypeName}
 */
var basicFn = {};
/**
 * 格式化数量
 * @param {Object} v
 * @return {TypeName}
 */
basicFn.formatNumber = function (v) {
    return v.toFixed(basicParams.numberFixed);
};
/**
 * 格式化布爾型
 * @param {Object} v
 */
basicFn.formatBoolean = function (v) {
    if (v === true || v == 1) {
        return '<p style="color:green;">是';
    } else {
        return '<p style="color:red;">否';
    }
};

/**author cxg 04-09
 * 格式化状态
 * @param {Object} v
 */
basicFn.formatStatus = function (v) {
    var res = '';
    switch (v) {
        case 0:
            res = '<font color="00CC00">审核已通过</font>';
            break;
        case 1:
            res = '<font color="000000">已删除</font>';
            break;
        case 2:
            res = '<font color="FF9900">正在审核中</font>';
            break;
        case 3:
            res = '<font color="FF0000">审核未通过</font>';
            break;
        case 4:
            res = '<font color="3300FF">信息不完整</font>';
            break;
        default:
            res = '<font color="FF9900">正在审核中</font>';
            break;
    }
    return res;
};

/**author cxg 04-15
 * 格式化开发者状态
 * @param {Object} v
 */
basicFn.formatDeveloperFlag = function (v) {
    if (v === true || v == 1) {
        return '删除';
    } else {
        return '正常';
    }
};
/**author cxg 04-15
 * 格式化开发者类型
 * @param {Object} v
 */
basicFn.formatDeveloperType = function (v) {
    if (v === true || v == 1) {
        return '公司';
    } else {
        return '个人';
    }
};
/**author cxg 04-15
 * 格式化开发者类型
 * @param {Object} v
 */
basicFn.trueOrfalse = function (v) {
    if (v === true || v == 1) {
        return '是';
    } else {
        return '否';
    }
};
/**
 * 格式化专区状态
 * @param {Object} v
 */
basicFn.formatZoneType = function (v) {
    if (v === true || v == 'DD00801') {
        return '启用';
    } else {
        return '<font color="FF0000">禁用</font>';
    }
};
/**
 * 格式化布爾型为图片显示
 * @param {Object} v
 */
basicFn.formatBooleanToImg = function (v) {
    if (v === true || v == 1) {
        return '<img src="' + origin.bp() + '/themes/images/icons/ok.png" />';
    } else {
        return '<img src="' + origin.bp() + '/themes/images/icons/no.png" />';
    }
};
/**
 * 格式化布爾型为图片显示
 * @param {Object} v
 */
basicFn.formatBooleanToImg2 = function (v) {
    if (v === true || v == 1) {
        return '<img src="' + origin.bp() + '/themes/images/icons/disable.png" />';
    } else {
        return '<img src="' + origin.bp() + '/themes/images/icons/enable.png" />';
    }
};
/**
 * 格式化布爾型为图片显示
 * @param {Object} v
 */
basicFn.formatBooleanToImg3 = function (v) {
    if (v === true || v == 1) {
        return '<img src="' + origin.bp() + '/themes/images/icons/no.png" />';
    } else {
        return '<img src="' + origin.bp() + '/themes/images/icons/ok.png" />';
    }
};
/**
 * 格式化单价
 * @param {Object} v
 * @return {TypeName}
 */
basicFn.formatPrice = function (v) {
    return v.toFixed(basicParams.priceFixed);
};
/**
 * 格式化百分数
 * @param {Object} v
 * @return {TypeName}
 */
basicFn.formatPercent = function (v) {
    return v.toFixed(basicParams.percentFixed) + '%';
};
/**
 * 格式化日期
 * @param {Object} v
 * @return {TypeName}
 */
basicFn.formatDate = function (v) {
    return new XDate(v).toString('yyyy-MM-dd');
};
/**
 * 格式化日期时间
 * @param {Object} v
 * @return {TypeName}
 */
basicFn.formatDateTime = function (v) {
    var new_date = new XDate(v);
    //消除14小时的时间提前量
    var time = new_date.getTime() - (14 * 60 * 60 * 1000);
    new_date.setTime(time);
    return v == null || v == '' ? '' : new_date.toString('yyyy-MM-dd HH:mm:ss');
//	return v=='null'?'':new XDate(v).toString('yyyy-MM-dd HH:mm:ss');
};


/**
 * 将大厅标签类型转为汉字
 */
basicFn.checkHallTagType = function (v) {
    var content = '';
    switch (v) {
        case 0:
            content = '<font color="blue">推荐</font>';
            break;
        case 1:
            content = '<font color="black">频道</font>';
            break;
        case 2:
            content = '<font color="green">列表</font>';
            break;
        default:
            content = '<font color="blue">推荐</font>';
            break;
    }
    return content;
};


/**
 * 转换imgURL到img HTML图片元素返回显示
 * @param v
 * @returns {*}
 */
basicFn.getImgShow = function (v) {
    if (v == null || v == "") {
        return '';
    } else {
        if (v.indexOf('.jpg') != -1 || v.indexOf('.png') != -1 || v.indexOf('.bmp') != -1 || v.indexOf('.webp') != -1) {
            return '<a href="' + v + '" target="_blank"><img width="100%" height="100%" src="' + v + '"></a>';
        } else {
            return v;
        }
    }
};

/**
 * 转换第三方来源为中文
 * @param v
 */
basicFn.getSource = function (v) {
    var content = '';
    if (v == null || v == '') {

    } else {
        switch (v) {
            case 'yinhe':
                content = '爱奇艺';
                break;
            case 'tencent':
                content = '腾讯';
                break;
            case 'voole':
                content = '优朋';
                break;
            case 'sky':
                content = '聚合';
                break;
        }
    }
    return content;
};

/**
 * 转换首页/资源模式为中文
 * @param v
 * @returns {string}
 */
basicFn.getTvModel = function (v) {
    var content = "";
    switch (v) {
        case 'normal':
            content = "正常模式";
            break;
        case 'aged':
            content = "老年模式";
            break;
        case 'child':
            content = "儿童模式";
            break;
        case 'live':
            content = "直播模式";
            break;
        default:
            break;
    }
    return content;
};


/**
 * 转换资源类型为中文
 * @param v
 */
basicFn.getResourceType = function (v) {
    var content = "";
    switch (v) {
        case 'res':
            content = "影片";
            break;
        case 'cat_c':
            content = "专题";
            break;
        case 'cat_s':
            content = "频道";
            break;
        case 'cat_l':
            content = "直播列表";
            break;
        case "live":
            content = "直播节目";
            break;
        case 'apk':
            content = "app应用";
            break;
        case 'video':
            content = "视频链接";
            break;
        case 'web':
            content = "网址链接";
            break;
    }
    return content;
}

/**
 * 重置ID下的所有表单数据
 *
 * @param id
 */
basicFn.resetForm = function (id) {

    $('#' + id + ' input , #' + id + ' select ')
        .not(':button, :submit, :reset, :hidden')
        .val('')
        .removeAttr('checked')
        .removeAttr('selected');
};

/**
 * 去除Array中的重复数据
 * @param array
 * @returns {*[]}
 */
function getUniqueArray(array) {
    array.sort();
    var re = [array[0]];
    for (var i = 1; i < array.length; i++) {
        if (array[i] !== re[re.length - 1]) {
            re.push(array[i]);
        }
    }
    return re;
}


/**
 * 最简单数组去重法
 * @param array
 * @returns {Array}
 */
function unique1(array) {
    var n = []; //一个新的临时数组
    //遍历当前数组
    for (var i = 0; i < array.length; i++) {
        //如果当前数组的第i已经保存进了临时数组，那么跳过，
        //否则把当前项push到临时数组里面
        if (n.indexOf(array[i]) == -1) n.push(array[i]);
    }
    return n;
}

/**
 *将数字转为对应的审核状态
 *0下架,1上架,2草稿,3待审核,4审核通过,5审核不通过
 */
basicFn.numToAuditStatus = function (num) {
    var auditStatus;
    if (typeof (num) == 'number') {
        switch (num) {
            case 0:
                auditStatus = "下架";
                break;
            case 1:
                auditStatus = "上架";
                break;
            case 2:
                auditStatus = "草稿";
                break;
            case 3:
                auditStatus = "待审核";
                break;
            case 4:
                auditStatus = "审核通过";
                break;
            case 5:
                auditStatus = "审核不通过";
                break;
            case 6:
                auditStatus = "审核中";
                break;
            case 7:
                auditStatus = "审核通过未上线";
                break;
            case 9:
                auditStatus = "待二次审核";
                break;
            default:
                auditStatus = "未知";
        }
    }
    return auditStatus;
};

/**
 *将实例类型字符串转为对应的实例类型标示
 *实例类型:版面-tab,板块-pannel,素材-material，布局-layout,首页-homepage，策略-policy，主题-theme
 */
/*basicFn.numToInstanceType = function(str){
 var auditStatus;
 if(typeof (str)=='string'){
 switch (str){
 case 'tab':auditStatus="版面";break;
 case 'pannel':auditStatus="版块";break;
 case 'material':auditStatus="素材";break;
 case 'layout':auditStatus="布局";break;
 case 'homepage':auditStatus="首页";break;
 case 'policy':auditStatus="策略";break;
 case 'theme':auditStatus="主题";break;
 default:auditStatus="未知";
 }
 }
 return auditStatus;
 };*/

/**
 *将数字转为对应的审核优先级标示
 *1一般,2重要,3紧急
 */
basicFn.numToReviewPriority = function (num) {
    var auditStatus;
    if (typeof (num) == 'number') {
        switch (num) {
            case 1:
                auditStatus = "一般";
                break;
            case 2:
                auditStatus = "重要";
                break;
            case 3:
                auditStatus = "紧急";
                break;
            default:
                auditStatus = "未知";
        }
    }
    return auditStatus;
};

/**
 *将数字转为对应的任务状态标示
 *1进行中,2终止,3结束,4失效
 */
basicFn.numToTaskStatus = function (num) {
    var auditStatus;
    if (typeof (num) == 'number') {
        switch (num) {
            case 1:
                auditStatus = "进行中";
                break;
            case 2:
                auditStatus = "终止";
                break;
            case 3:
                auditStatus = "结束";
                break;
            case 4:
                auditStatus = "失效";
                break;
            default:
                auditStatus = "未知";
        }
    }
    return auditStatus;
};

/**
 *将数字转为对应的策略分类标示
 *1为正式策略,2为测试策略
 */
basicFn.numToPolicyStatus = function (num) {
    var auditStatus;
    if (typeof (num) == 'number') {
        switch (num) {
            case 1:
                auditStatus = "正式策略";
                break;
            case 2:
                auditStatus = "测试策略";
                break;
            default:
                auditStatus = "未知";
        }
    }
    return auditStatus;
};

/**
 *将数字转为对应的策略类型标示
 *1影视内容策略,2主题内容策略
 */
basicFn.numToPolicyContentStatus = function (num) {
    var auditStatus;
    if (typeof (num) == 'number') {
        switch (num) {
            case 1:
                auditStatus = "影视内容策略";
                break;
            case 2:
                auditStatus = "主题内容策略";
                break;
            default:
                auditStatus = "未知";
        }
    }
    return auditStatus;
};

/**
 *将数字转为对应的版块类型
 *1常规,2排行版,3业务专辑,4智能化推荐,5专属影院
 */
basicFn.numToPannelTypeUrl = function (num) {
    var pnnelTypeUrl = $basePath;
    switch (num) {
        case 1:
        case '1':
        case 7:
        case '7':
            pnnelTypeUrl = "/pannelInfo/";
            break;
        case 2:
        case '2':
            pnnelTypeUrl = "/topPannelInfo/";
            break;
        case 3:
        case '3':
            pnnelTypeUrl = "/albumPannelInfo/";
            break;
        case 4:
        case '4':
            pnnelTypeUrl = "/intelliReccomendPannel/";
            break;
        case 5:
        case '5':
            pnnelTypeUrl = "/privatePannelInfo/";
            break;
        case  8:
        case '8':
            pnnelTypeUrl = "/markPanel/";
            break;
        case 9:
        case '9':
        case 10:
        case '10':
            pnnelTypeUrl = "/privatePannelInfo/";
            break;
        default:
            break;
    }
    return pnnelTypeUrl;
};
/**
 * 根据板块类型-获取分页数据url-版面处调用的
 * @param pannelType
 */
basicFn.getPanelPageListUrl = function (pannelType) {
    var pnnelTypeUrl = $basePath;
    switch (pannelType) {
        case 1:
        case '1':
        case 3:
        case '3':
        case 7 :
        case '7' :
        case  8:
        case '8':
            pnnelTypeUrl = "/panel/dataList.html?pannelType=" + pannelType;
            break;
        case 5:
        case '5':
        case 9:
        case '9':
        case 10:
        case '10':
            pnnelTypeUrl = "/privatePannelInfo/pageList.html?pannelStatus=4";
            break;
        default:
            break;
    }
    return pnnelTypeUrl;
};
/***********************************************************************************************
 *@method : convertResourceSubType2CnName
 *@desc   : 将资源子类型转化中文名称
 *@param  : {str}resourceType:参数名-资源类型
 *@param  : {number}subType:子类型数值
 *@return : {str}subTypeCnName:子类型中文名称
 *@author bjh
 *@date 2019-01-21
 ***********************************************************************************************/
basicFn.convertResourceSubType2CnName = function (resourceType, subTypeNum) {
    var subTypeCnName;
    subTypeCnName = '未知类型，请进行处理（/scripts/common/utils.js）！传入类型为：' + subTypeNum;
    if ('pannel' === resourceType) {
        if (subTypeNum === 1) {
            subTypeCnName = '常规板块';
        } else if (subTypeNum === 3) {
            subTypeCnName = '业务专辑';
        }
    } else if ('tab' === resourceType) {
        if (subTypeNum === 1) {
            subTypeCnName = '普通版面';
        } else if (subTypeNum === 2) {
            subTypeCnName = '专辑版面';
        } else if (subTypeNum === 3) {
            subTypeCnName = '影片详情页';
        }
    }
    return subTypeCnName;
};